﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.OracleClient;
using System.Data;

namespace IBS
{
    public partial class IbsDataContext
    {
        public void SaveHQCSupplierCode(HQCSUPPLIER_CODE supplerCode)
        {
            using (var connection = new OracleConnection(this.connectionString))
            {
                connection.Open();
                using (var command = new OracleCommand())
                {
                    command.Connection = connection;
                    command.CommandType = CommandType.StoredProcedure;
                    command.CommandText = "edex.USP_ADD_HQCSUPPLIERCODE";
                    command.Parameters.Clear();
                    command.Parameters.AddWithValue("p_SITECODE", supplerCode.SITECODE);
                    command.Parameters.AddWithValue("p_SUPPLIERSHORTCODE", supplerCode.HQC_SHORTCODE);
                    command.Parameters.AddWithValue("p_SUPPLIERLONGNAME", supplerCode.HQC_LONGCODE);
                    command.ExecuteNonQuery();
                }
            }
        }

        public void DeleteHQCSupplierCode(Int64 siteCode)
        {
            using (var connection = new OracleConnection(this.connectionString))
            {
                connection.Open();
                using (var command = new OracleCommand())
                {
                    command.Connection = connection;
                    command.CommandType = CommandType.StoredProcedure;
                    command.CommandText = "edex.USP_DELETE_HQCSUPPLIERCODE";
                    command.Parameters.Clear();
                    command.Parameters.AddWithValue("p_SITECODE", siteCode);
                    command.ExecuteNonQuery();                    
                }
            }
        }

    }
}
